<template>
    <div>
        <div class="e-form" v-if="dialogVisible === false">
            <BillTop :title="$route.meta.title" @cancel="handleClose"></BillTop>
            <div class="tabs warningTabs"></div>
            <div class="tabs" v-if="Object.keys(formData).length != 0">
                <!-- 编辑 -->
                <el-tabs
                    tab-position="left"
                    v-model="tabsName"
                    @tab-click="onChangeTab"
                    v-if="auditState.canModify"
                >
                    <!-- 基本信息 -->
                    <el-tab-pane
                        label="基本信息"
                        name="baseInfo"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="拟招标内容明细"
                        name="detail"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="招标清单"
                        name="tenderList"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="公文文件"
                        name="files"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="招标条款"
                        name="clause"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="附件信息"
                        name="attach"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="审核历史"
                        name="auditHistory"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="补遗记录"
                        name="recodes"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="关闭记录"
                        name="close"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane label="报名记录" name="reg" :disabled="clickTabFlag"></el-tab-pane>
                    <el-tab-pane
                        label="评标结果记录"
                        name="bidEvaluation"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="招标公示记录"
                        name="biddingPublicity"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="中标通知书记录"
                        name="bidWinningNotice"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <div>
                        <div id="baseInfoCon" class="con">
                            <div class="tabs-title" id="baseInfo">基本信息</div>
                            <div style="width: 100%" class="form">
                                <el-form
                                    :model="formData"
                                    label-width="170px"
                                    :rules="rules"
                                    ref="ruleForm"
                                >
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="招标编号：" prop="billNo">
                                                <span>{{ formData.billNo }}</span>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item
                                                label="拟招标项目名称："
                                                prop="tenderName"
                                            >
                                                <el-input
                                                    v-model="formData.tenderName"
                                                    placeholder="填写"
                                                ></el-input>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <!-- kvId、name -->
                                            <el-form-item label="招标方式：" prop="tenderForm">
                                                <el-select
                                                    v-model="formData.tenderForm"
                                                    placeholder="请选择"
                                                    @change="selectChange($event, '招标方式')"
                                                >
                                                    <el-option
                                                        v-for="item in options.tenderForm"
                                                        :key="item.value"
                                                        :label="item.label"
                                                        :value="item.value"
                                                    >
                                                    </el-option>
                                                </el-select>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="招标类型：" prop="tenderType">
                                                <el-select
                                                    v-model="formData.tenderType"
                                                    placeholder="请选择"
                                                    @change="selectChange($event, '招标类型')"
                                                >
                                                    <el-option
                                                        v-for="item in options.tenderType"
                                                        :key="item.key"
                                                        :label="item.value"
                                                        :value="item.key"
                                                    >
                                                    </el-option>
                                                </el-select>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="项目名称：" prop="projectName">
                                                <div style="display: flex">
                                                    <span>{{ formData.projectName }}</span>
                                                    <ComShowProjectButton
                                                        :billId="formData.projectId"
                                                    />
                                                </div>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="招标公告：" prop="tenderNotice">
                                                <el-button
                                                    style="width: 222px"
                                                    class="btn-greenYellow"
                                                    @click="handleNotice"
                                                    >招标公告
                                                </el-button>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item
                                                label="投标保证金（元）："
                                                prop="tenderBail"
                                            >
                                                <el-input
                                                    v-model="formData.tenderBail"
                                                    v-enterJustFloat
                                                    @blur="inputblur(formData, 'tenderBail')"
                                                ></el-input>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <!-- id、name -->
                                            <el-form-item label="币种：" prop="currencyId">
                                                <el-select
                                                    v-model="formData.currencyId"
                                                    placeholder="请选择"
                                                    @change="selectChange($event, '币种')"
                                                >
                                                    <el-option
                                                        v-for="item in options.currency"
                                                        :key="item.kvValue"
                                                        :label="item.kvKey"
                                                        :value="item.kvValue"
                                                    >
                                                    </el-option>
                                                </el-select>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item
                                                label="拟招标金额（元）："
                                                prop="tenderAmount"
                                            >
                                                <span>{{ formData.tenderAmount }}</span>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="税额：" prop="taxAmount">
                                                <span>{{
                                                    formData.taxAmount === 0
                                                        ? '汇总计算包件税额金额'
                                                        : formData.taxAmount
                                                }}</span>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="申请日期：" prop="applyTime">
                                                <el-date-picker
                                                    v-model="formData.applyTime"
                                                    type="date"
                                                    placeholder="选择日期"
                                                    :clearable="false"
                                                    value-format="yyyy-MM-dd"
                                                >
                                                </el-date-picker>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="招标状态：" prop="tenderState">
                                                <span>{{
                                                    formData.state === 5
                                                        ? '已作废'
                                                        : this.options.tenderState.find(
                                                              (item, index) => {
                                                                  return (
                                                                      formData.tenderState === index
                                                                  )
                                                              }
                                                          )
                                                }}</span>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="申请状态：" prop="state">
                                                <span>{{ formData.state | state(this) }}</span>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <!-- id、name -->
                                            <el-form-item label="申请单位：" prop="applyOrgName">
                                                <ComInputSelectUnit
                                                    :orgName.sync="formData.applyOrgName"
                                                    :orgId.sync="formData.applyOrgId"
                                                    :SelectedIDs="
                                                        formData.applyOrgId !== ''
                                                            ? [formData.applyOrgId]
                                                            : []
                                                    "
                                                />
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <ComNullify :formData="formData" />
                                    <el-row>
                                        <el-form-item
                                            label="招标项目工程概况："
                                            prop="projectOverview"
                                        >
                                            <el-input
                                                type="textarea"
                                                :rows="2"
                                                placeholder="请输入内容"
                                                v-model="formData.projectOverview"
                                                style="margin-right: 110px"
                                            >
                                            </el-input>
                                        </el-form-item>
                                    </el-row>
                                    <el-row>
                                        <el-form-item label="备注：" prop="remarks">
                                            <el-input
                                                type="textarea"
                                                :rows="2"
                                                placeholder="请输入内容"
                                                v-model="formData.remarks"
                                                style="margin-right: 110px"
                                            >
                                            </el-input>
                                        </el-form-item>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="录入机构：" prop="orgName">
                                                <!-- 传id和名称 -->
                                                <span>{{ formData.orgName }}</span>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="招标单位：" prop="tenderUser">
                                                <ComInputSelectUnit
                                                    :orgName.sync="formData.tenderUser"
                                                    :orgId.sync="formData.tenderUserId"
                                                    :SelectedIDs="
                                                        formData.tenderUserId !== ''
                                                            ? [formData.tenderUserId]
                                                            : []
                                                    "
                                                    type="getParentOrg"
                                                />
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="本位币：" prop="baseCurName">
                                                <!-- 传id和名称 -->
                                                <span>{{ formData.baseCurName }}</span>
                                            </el-form-item>
                                        </el-col>
                                        <el-col
                                            :span="12"
                                            v-if="formData.baseCurName !== formData.currency"
                                        >
                                            <el-form-item label="人民币汇率：" prop="rmbRate">
                                                <span>{{ formData.rmbRate }}</span>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12" v-if="formData.releaseState === 1">
                                            <el-form-item label="发布时间：">
                                                <!-- 传id和名称 -->
                                                <span>{{ formData.relaseTime }}</span>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                </el-form>
                            </div>
                        </div>

                        <div id="detailCon" class="con">
                            <div class="tabs-title" id="detail">拟招标内容明细</div>
                            <div>
                                <ComDetailsOfProposedIndex
                                    ref="ComDetailsOfProposedIndex"
                                    :tenderData="formData"
                                    v-model="detailsData"
                                    @onChangeTab="onChangeTab"
                                    :tenderListData="tenderListData"
                                    :auditState="auditState"
                                />
                            </div>
                        </div>

                        <div id="tenderListCon" class="con">
                            <div class="tabs-title" id="tenderList">招标清单</div>
                            <ComtenderListIndex
                                ref="ComtenderListIndex"
                                :auditState="auditState"
                                :isAdd="auditState.canModify"
                                :isEdit="auditState.canModify"
                                :state="formData.state"
                                :detailsData="detailsData"
                                v-model="tenderListData"
                                @onChangeTab="onChangeTab"
                                @startEndStake="startEndStake"
                            />
                        </div>

                        <div id="filesCon" class="con">
                            <div class="tabs-title" id="files">公文文件</div>
                            <ComFilesIndex
                                ref="ComFilesIndex"
                                com="bidding"
                                :auditState="auditState"
                            />
                        </div>

                        <div
                            id="clauseCon"
                            class="con"
                            style="padding-bottom: 0; height: 880px"
                            v-show="formData.tenderType === 1"
                        >
                            <div class="tabs-title" id="clause">招标条款</div>
                            <div style="height: 800px">
                                <iframe
                                    id="iframe"
                                    :src="formData.tenderClausePath"
                                    :class="iframeClass"
                                    frameborder="0"
                                ></iframe>
                                <!-- <iframe
                                    id="iframe"
                                    :src="formData.tenderClausePath"
                                    style='position: fixed;right:0px;top:0px'
                                    frameborder="0"
                                ></iframe> -->
                            </div>
                        </div>

                        <div id="attachCon" class="con" style="margin-top: 880px">
                            <div class="tabs-title" id="attach">附件信息</div>
                            <ComAttachIndex
                                bucketName="tender"
                                :relationId="tenderId"
                                ref="ComAttachIndex"
                                :key="1"
                                :isView="
                                    (auditState.canAudit === false &&
                                        auditState.canModify === false) ||
                                    Object.keys(auditState).length === 0
                                "
                                v-if="Object.keys(auditState).length !== 0"
                            />
                        </div>

                        <!-- billType 工程施工招标6021 其他工程招标6022 物资供应招标6023 物资加工招标6024
                    周材租赁招标6025 服务采购招标6026 机材收入招标6027 设备采购招标6028
                    设备租赁招标6029 -->
                        <div id="auditHistoryCon" class="con">
                            <div class="tabs-title" id="auditHistory">审核历史</div>
                            <ComExaHistory :billType="6021" ref="ComExaHistory" />
                        </div>

                        <div id="recodesCon" class="con">
                            <div class="tabs-title" id="recodes">补遗记录</div>
                            <ComTenderAddendumIndex />
                        </div>

                        <div id="closeCon" class="con">
                            <div class="tabs-title" id="close">关闭记录</div>
                            <ComBidClosingIndex />
                        </div>

                        <div id="regCon" class="con">
                            <div class="tabs-title" id="reg">报名记录</div>
                            <ComOpenBiddingRegIndex />
                        </div>

                        <div id="bidEvaluationCon" class="con">
                            <div class="tabs-title" id="bidEvaluation">评标结果记录</div>
                            <ComBidEvaluationResultIndex />
                        </div>

                        <div id="biddingPublicityCon" class="con">
                            <div class="tabs-title" id="biddingPublicity">招标公示记录</div>
                            <ComBiddingResultIndex />
                        </div>

                        <div id="bidWinningNoticeCon">
                            <div class="tabs-title" id="bidWinningNotice">中标通知书记录</div>
                            <ComBidWinningNoticeIndex />
                        </div>
                    </div>
                </el-tabs>
                <!-- 查看 -->
                <el-tabs tab-position="left" v-model="tabsName" @tab-click="onChangeTab" v-else>
                    <!-- 基本信息 -->
                    <el-tab-pane
                        label="基本信息"
                        name="baseInfo"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="拟招标内容明细"
                        name="detail"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="招标清单"
                        name="tenderList"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="公文文件"
                        name="files"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="招标条款"
                        name="clause"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="附件信息"
                        name="attach"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="审核历史"
                        name="auditHistory"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="补遗记录"
                        name="recodes"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="关闭记录"
                        name="close"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane label="报名记录" name="reg" :disabled="clickTabFlag"></el-tab-pane>
                    <el-tab-pane
                        label="评标结果记录"
                        name="bidEvaluation"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="招标公示记录"
                        name="biddingPublicity"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <el-tab-pane
                        label="中标通知书记录"
                        name="bidWinningNotice"
                        :disabled="clickTabFlag"
                    ></el-tab-pane>
                    <div>
                        <div id="baseInfoCon" class="con">
                            <div class="tabs-title" id="baseInfo">基本信息</div>
                            <div style="width: 100%" class="form">
                                <el-form
                                    :model="formData"
                                    label-width="170px"
                                    :rules="rules"
                                    ref="ruleForm"
                                >
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="招标编号：" prop="billNo">
                                                <span>{{ formData.billNo }}</span>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item
                                                label="拟招标项目名称："
                                                prop="tenderName"
                                            >
                                                <span>{{ formData.tenderName }}</span>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <!-- kvId、name -->
                                            <el-form-item label="招标方式：" prop="tenderForm">
                                                <span>{{
                                                    formData.tenderForm | tenderForm(this)
                                                }}</span>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="招标类型：" prop="tenderType">
                                                <span>{{
                                                    formData.tenderType | tenderType(this)
                                                }}</span>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="项目名称：" prop="projectName">
                                                <div style="display: flex">
                                                    <span>{{ formData.projectName }}</span>
                                                    <ComShowProjectButton
                                                        :billId="formData.projectId"
                                                    />
                                                </div>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="招标公告：" prop="tenderNotice">
                                                <el-button
                                                    style="width: 222px"
                                                    class="btn-greenYellow"
                                                    @click="handleNotice"
                                                    >招标公告
                                                </el-button>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item
                                                label="投标保证金（元）："
                                                prop="tenderBail"
                                            >
                                                <span>{{ formData.tenderBail }}</span>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <!-- id、name -->
                                            <el-form-item label="币种：" prop="currencyId">
                                                <span>{{
                                                    formData.currencyId | currencyId(this)
                                                }}</span>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item
                                                label="拟招标金额（元）："
                                                prop="tenderAmount"
                                            >
                                                <span>{{
                                                    formData.tenderAmount === 0
                                                        ? '汇总计算包件的最高限价'
                                                        : formData.tenderAmount
                                                }}</span>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="税额：" prop="taxAmount">
                                                <span>{{
                                                    formData.taxAmount === 0
                                                        ? '汇总计算包件税额金额'
                                                        : formData.taxAmount
                                                }}</span>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="申请日期：" prop="applyTime">
                                                <span>{{ formData.applyTime }}</span>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="招标状态：" prop="tenderState">
                                                <span>{{
                                                    formData.state === 5
                                                        ? '已作废'
                                                        : this.options.tenderState.find(
                                                              (item, index) => {
                                                                  return (
                                                                      formData.tenderState === index
                                                                  )
                                                              }
                                                          )
                                                }}</span>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="申请状态：" prop="state">
                                                <span>{{ formData.state | state(this) }}</span>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <!-- id、name -->
                                            <el-form-item label="申请单位：" prop="applyOrgName">
                                                <span>{{ formData.applyOrgName }}</span>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <ComNullify :formData="formData" />
                                    <el-row>
                                        <el-form-item
                                            label="招标项目工程概况："
                                            prop="projectOverview"
                                        >
                                            <span>{{ formData.projectOverview }}</span>
                                        </el-form-item>
                                    </el-row>
                                    <el-row>
                                        <el-form-item label="备注：" prop="remarks">
                                            <span>{{ formData.remarks }}</span>
                                        </el-form-item>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="录入机构：" prop="orgName">
                                                <!-- 传id和名称 -->
                                                <span>{{ formData.orgName }}</span>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="12">
                                            <el-form-item label="招标单位：" prop="tenderUser">
                                                <span>{{ formData.tenderUser }}</span>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12">
                                            <el-form-item label="本位币：" prop="baseCurName">
                                                <!-- 传id和名称 -->
                                                <span>{{ formData.baseCurName }}</span>
                                            </el-form-item>
                                        </el-col>
                                        <el-col
                                            :span="12"
                                            v-if="formData.baseCurName !== formData.currency"
                                        >
                                            <el-form-item label="人民币汇率：" prop="rmbRate">
                                                <span>{{ formData.rmbRate }}</span>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                    <el-row>
                                        <el-col :span="12" v-if="formData.releaseState === 1">
                                            <el-form-item label="发布时间：">
                                                <!-- 传id和名称 -->
                                                <span>{{ formData.relaseTime }}</span>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                </el-form>
                            </div>
                        </div>

                        <div id="detailCon" class="con">
                            <div class="tabs-title" id="detail">拟招标内容明细</div>
                            <div>
                                <ComDetailsOfProposedIndex
                                    ref="ComDetailsOfProposedIndex"
                                    :tenderData="formData"
                                    v-model="detailsData"
                                    @onChangeTab="onChangeTab"
                                    :tenderListData="tenderListData"
                                    :auditState="auditState"
                                    :canEdit="auditState.canModify"
                                />
                            </div>
                        </div>

                        <div id="tenderListCon" class="con">
                            <div class="tabs-title" id="tenderList">招标清单</div>
                            <ComtenderListIndex
                                ref="ComtenderListIndex"
                                :auditState="auditState"
                                :isAdd="auditState.canModify"
                                :isEdit="auditState.canModify"
                                :state="formData.state"
                                :detailsData="detailsData"
                                v-model="tenderListData"
                                @onChangeTab="onChangeTab"
                                @startEndStake="startEndStake"
                            />
                        </div>

                        <div id="filesCon" class="con">
                            <div class="tabs-title" id="files">公文文件</div>
                            <ComFilesIndex
                                ref="ComFilesIndex"
                                style="margin-top: -10px"
                                com="bidding"
                                :auditState="auditState"
                            />
                        </div>

                        <div
                            id="clauseCon"
                            class="con"
                            style="padding-bottom: 0; height: 1200px"
                            v-show="formData.tenderType === 1"
                        >
                            <div class="tabs-title" id="clause">招标条款</div>
                            <div style="height: 800px; position: relative">
                                <iframe
                                    id="iframe"
                                    :src="formData.tenderClausePath"
                                    :class="iframeClass"
                                    frameborder="0"
                                ></iframe>
                            </div>
                        </div>

                        <div id="attachCon" class="con" style="margin-top: 880px">
                            <div class="tabs-title" id="attach">附件信息</div>
                            <ComAttachIndex
                                bucketName="tender"
                                :canEdit="auditState.canModify"
                                :relationId="tenderId"
                                ref="ComAttachIndex"
                                :key="2"
                                :isView="
                                    (auditState.canAudit === false &&
                                        auditState.canModify === false) ||
                                    Object.keys(auditState).length === 0
                                "
                                v-if="Object.keys(auditState).length !== 0"
                            />
                        </div>

                        <!-- billType 工程施工招标6021 其他工程招标6022 物资供应招标6023 物资加工招标6024
                    周材租赁招标6025 服务采购招标6026 机材收入招标6027 设备采购招标6028
                    设备租赁招标6029 -->
                        <div id="auditHistoryCon" class="con">
                            <div class="tabs-title" id="auditHistory">审核历史</div>
                            <ComExaHistory :billType="6021" ref="ComExaHistory" />
                        </div>

                        <div id="recodesCon" class="con">
                            <div class="tabs-title" id="recodes">补遗记录</div>
                            <ComTenderAddendumIndex />
                        </div>

                        <div id="closeCon" class="con">
                            <div class="tabs-title" id="close">关闭记录</div>
                            <ComBidClosingIndex />
                        </div>

                        <div id="regCon" class="con">
                            <div class="tabs-title" id="reg">报名记录</div>
                            <ComOpenBiddingRegIndex />
                        </div>

                        <div id="bidEvaluationCon" class="con">
                            <div class="tabs-title" id="bidEvaluation">评标结果记录</div>
                            <ComBidEvaluationResultIndex />
                        </div>

                        <div id="biddingPublicityCon" class="con">
                            <div class="tabs-title" id="biddingPublicity">招标公示记录</div>
                            <ComBiddingResultIndex />
                        </div>

                        <div id="bidWinningNoticeCon">
                            <div class="tabs-title" id="bidWinningNotice">中标通知书记录</div>
                            <ComBidWinningNoticeIndex />
                        </div>
                    </div>
                </el-tabs>
            </div>
            <div id="seat" :style="{ height: seatHeight + 'px' }"></div>
            <!-- v-if="Object.keys(auditState).length !== 0" -->
            <div class="buttons" v-if="$route.query.isview === undefined">
                <ComBidButtons :formData="formData" ref="ComBidButtons" @getData="getData" />
                <ComExaButtons
                    :auditState="auditState"
                    @exas="exas"
                    :routeTo="
                        () => {
                            this.$router.push('./biddingApplication')
                        }
                    "
                    :founderId="formData.founderId"
                    :state="formData.state"
                    :isPrint="false"
                />
                <!-- <el-button type="primary" class="btn-blue" size="small">打印</el-button> -->
                <el-button @click="handleClose" size="small">取消</el-button>
            </div>
            <div class="buttons-seize-a-seat"></div>
        </div>
        <!-- dialog -->
        <ComNoticeDialog
            ref="ComNoticeDialog"
            :dialogVisible.sync="dialogVisible"
            :tenderClass="parseInt(formData.tenderClass)"
            :tenderForm="String(formData.tenderForm)"
            v-if="Object.keys(formData).length !== 0"
            :content="formData.tenderNotice"
            @save="noticeSave"
            :canEdit="auditState.canModify"
        />
    </div>
</template>

<script>
import '@/utils/jquery.scrollTo.min'
import applyRequest from '@/api/tender/apply.js'
import auditRequest from '@/api/tender/audit.js'
import commonRequest from '@/api/tender/common.js'
// import ComTreeTable from '@/templates/table/treeTable.vue'
// import ComTreeFile from '@/templates/table/treeFile.vue'
// import ComPagination from '@/components/pagination/pagination.vue'
import ComNoticeDialog from '@/components/common/noticeDialog.vue'
import ComExaHistory from '@/components/common/exaHistory.vue'
import ComTenderAddendumIndex from '@/pages/bidding/laborBidding/tenderAddendum/tenderAddendumIndex'
import ComBidClosingIndex from '@/pages/bidding/laborBidding/bidClosing/bidClosingIndex'
import ComBiddingResultIndex from '@/pages/bidding/laborBidding/biddingResult/biddingResultIndex'
import ComBidEvaluationResultIndex from '@/pages/bidding/laborBidding/bidEvaluationResult/bidEvaluationResultIndex'
import ComBidWinningNoticeIndex from '@/pages/bidding/laborBidding/bidWinningNotice/bidWinningNoticeIndex'
import ComOpenBiddingRegIndex from '@/pages/bidding/laborBidding/openBiddingReg/openBiddingRegIndex'
import ComDetailsOfProposedIndex from '@/pages/bidding/laborBidding/detailsOfProposed/detailsOfProposedIndex'
import ComAttachIndex from '@/components/common/attachIndex'
import ComFilesIndex from '@/pages/bidding/common/filesIndex'
import ComtenderListIndex from '@/pages/bidding/laborBidding/tenderList/tenderListIndex'
import ComExaButtons from '@/components/common/exaButtons'
import ComBidButtons from '@/components/bidding/bidButtons'
import ComInputSelectUnit from '@/pages/bidding/common/inputSelectUnit.vue'
import ComNullify from '@/pages/bidding/common/nullify.vue'
import ComShowProjectButton from '@/pages/bidding/common/showProjectButton.vue'
import authRequest from '@/api/identity/auth.js'
// import tenderRequest from '@/api/tender/tender.js'
import { selectDataClient, openAppClient } from '@/utils/common'
import { mapState, mapMutations } from 'vuex'
import axios from 'axios'
import store from '@/store'

export default {
    data () {
        // const not0 = (rule, value, callback) => {
        //     if (typeof value === 'number' && value === 0) {
        //         return callback(new Error('数值不能为0'))
        //     } else {
        //         callback()
        //     }
        // }
        const not0RmbRate = (rule, value, callback) => {
            if (typeof value === 'number' && value === 0) {
                return callback(new Error('人民币汇率不能为0'))
            } else {
                callback()
            }
        }
        const greaterZero = (rule, value, callback) => {
            if (typeof value === 'number' && value < 0) {
                return callback(new Error('不能为负数'))
            } else {
                callback()
            }
        }
        return {
            tabsName: 'baseInfo',
            screenWidth: 0,
            screenHeight: 0,
            lastConHeight: 0,
            clickTabFlag: false, // 如果手动点击时，则不做滚动事件逻辑，只有滚动屏幕时才走滚动事件逻辑
            form: {
                name: '',
                region: '',
                date1: '',
                date2: '',
                delivery: false,
                type: [],
                resource: '',
                desc: ''
            },
            tableData: [],
            value: '',
            textarea: '',
            formData: {},
            currentTabComponentName: '',
            selectData: [],
            orgSelectTableColumnAttr: [
                {
                    label: '机构Id',
                    prop: 'orgId'
                },
                {
                    label: '机构名称',
                    prop: 'orgName'
                }
            ],
            docSelectTableColumnAttr: [
                {
                    label: '序号'
                },
                {
                    label: '文件编号',
                    prop: 'docNum'
                },
                {
                    label: '公文文件名称',
                    prop: 'name'
                },
                {
                    label: '备案时间',
                    prop: 'oaCreateTime'
                },
                {
                    label: '备案人',
                    prop: 'userName'
                }
                // {
                //     label: '上传时间',
                //     prop: ''
                // }
            ],
            selectTableColumnWidth: {
                leftWidth: '150',
                rightWidth: '100'
            },
            selectDataPagination: {},
            loadComponent: new Set(),
            cloneFormDataStr: '',
            // 招标单据
            // 工程施工招标6021 其他工程招标6022 物资供应招标6023 物资加工招标6024 周材租赁招标6025 服务采购招标6026 机材收入招标6027 设备采购招标6028 设备租赁招标6029
            auditParams: {
                billId: this.$route.query.tenderId || this.$route.query.billid,
                billType: 6021,
                freeNextUnitIndex: 0,
                freeNextUser: '',
                isPass: true,
                isShareInAudit: true,
                opinion: ''
            },
            nullifyParams: {
                billId: this.$route.query.tenderId || this.$route.query.billid,
                billType: 6021,
                nullifyCreated: '',
                nullifyCreator: '',
                nullifyCreatorId: '',
                nullifyDescription: '',
                nullifyReason: ''
            },
            auditState: {
                // canModify: false
            },
            dialogVisible: false,
            tenderListShow: 0,
            rules: {
                billNo: {
                    required: true,
                    message: '请输入招标编号',
                    trigger: 'blur'
                },
                tenderName: {
                    required: true,
                    message: '请输入拟招标项目名称',
                    trigger: 'blur'
                },
                tenderForm: {
                    required: true,
                    message: '请选择招标方式',
                    trigger: 'change'
                },
                tenderType: {
                    required: true,
                    message: '请选择招标类型',
                    trigger: 'change'
                },
                projectName: {
                    required: true,
                    message: '请输入项目名称',
                    trigger: 'blur'
                },
                // tenderNotice: { required: true, message: '请输入公告', trigger: 'change' },
                tenderBail: [
                    {
                        required: true,
                        message: '请输入投标保证金（元）',
                        trigger: 'blur'
                    },
                    // { type: 'number', message: '保证金必须为数字值' },
                    { validator: greaterZero, trigger: 'blur' }
                ],
                currencyId: {
                    required: true,
                    message: '请选择币种',
                    trigger: 'change'
                },
                tenderAmount: {
                    required: true,
                    message: '请输入拟招标金额（元）',
                    trigger: 'blur'
                },
                taxAmount: {
                    required: true,
                    message: '请输入税额',
                    trigger: 'blur'
                },
                applyTime: {
                    required: true,
                    message: '请选择申请日期',
                    trigger: 'change'
                },
                tenderState: {
                    required: true,
                    message: '请输入招标状态',
                    trigger: 'blur'
                },
                state: {
                    required: true,
                    message: '请输入申请状态',
                    trigger: 'blur'
                },
                applyOrgName: {
                    required: true,
                    message: '请选择申请单位',
                    trigger: 'change'
                },
                projectOverview: [
                    {
                        required: true,
                        message: '请输入招标项目工程概况',
                        trigger: 'blur'
                    },
                    {
                        max: 500,
                        message: '最多允许输500个汉字',
                        trigger: 'blur'
                    }
                ],
                remarks: [
                    // { required: true, message: '请输入备注', trigger: 'blur' },
                    {
                        max: 500,
                        message: '最多允许输500个汉字',
                        trigger: 'blur'
                    }
                ],
                orgName: {
                    required: true,
                    message: '请输入录入机构',
                    trigger: 'blur'
                },
                tenderUser: {
                    required: true,
                    message: '请选择招标单位',
                    trigger: 'change'
                },
                baseCurName: {
                    required: true,
                    message: '没有设置本位币，请联系集团信息化管理员设置！',
                    trigger: 'blur'
                },
                rmbRate: [
                    {
                        required: true,
                        message: '请选择币种',
                        trigger: 'change'
                    },
                    { validator: not0RmbRate, trigger: 'change' }
                ]
            },
            tabsNameArr: [],
            detailsState: false,
            tenderListData: [], //清单数据
            detailsData: [], //包件数据
            // 用来刷新组件
            key: {
                tenderList: 0
            },
            iframeClass: ''
        }
    },
    computed: {
        // 填补底部空白，以使高度够滚动
        seatHeight () {
            return this.screenHeight - 40 - this.lastConHeight
        },
        ...mapState({
            options: state => state.biddingApplication.dictionaries,
            userInfo: state => state.userInfo
        }),
        tenderId () {
            return this.$route.query.tenderId || this.$route.query.billid
        }
    },
    watch: {
        detailsData: {
            handler (val) {
                // 计算拟招标金额
                this.formData.tenderAmount = val.reduce((total, cur) => {
                    return total + cur.priceLimit
                }, 0)
                // 计算税额
                this.formData.taxAmount = val.reduce((total, cur) => {
                    return total + cur.taxAmount
                }, 0)
            },
            deep: true
        },
        tabsName: {
            handler: function (val) {
                console.log(val)
                if (val === 'clause') {
                    this.iframeClass = 'clauseFixed'
                } else {
                    this.iframeClass = 'normal'
                }
            }
        }
        // auditState: {
        //     handler (val) {
        //         if (val.canModify === false) {
        //             this.$router.push({
        //                 path: './biddingApplicationShow',
        //                 query: { tenderId: this.tenderId }
        //             })
        //         }
        //     },
        //     deep: true
        // },
        // formData: {
        //     handler (val) {
        //         if (val.state === 5) {
        //             const tempInterval = setInterval(() => {
        //                 if (this.auditState?.canModify) {
        //                     this.auditState.canModify = false
        //                     clearInterval(tempInterval)
        //                 }
        //             }, 100)
        //             setTimeout(() => {
        //                 clearInterval(tempInterval)
        //             }, 1000)
        //         }
        //     },
        //     deep: true
        // }
    },
    components: {
        // ComTreeTable,
        // ComTreeFile,
        // ComPagination,
        ComTenderAddendumIndex,
        ComBidClosingIndex,
        ComBiddingResultIndex,
        ComBidEvaluationResultIndex,
        ComBidWinningNoticeIndex,
        ComExaHistory,
        ComOpenBiddingRegIndex,
        ComDetailsOfProposedIndex,
        ComAttachIndex,
        ComFilesIndex,
        ComtenderListIndex,
        ComNoticeDialog,
        ComBidButtons,
        ComExaButtons,
        ComInputSelectUnit,
        ComNullify,
        ComShowProjectButton
    },
    async created () {
        console.log('router', this.$route)
        // setTimeout(() => {
        //     console.log('options.tenderForm', this.options.tenderForm)
        // }, 2000)
        const promise1 = await this.getData()
        const promise2 =
            this.formData.state === -1 || this.formData.state === 2 || this.formData.state === 5
                ? null
                : this.getCurrentUnitInfo()
        await Promise.all([promise1, promise2]).then(() => {
            // 不请求审核接口也需要给附件v-if显示
            if (Object.keys(this.auditState).length === 0) {
                this.auditState.canModify = false
                this.auditState.canAudit = false
            }
            this.ifSeat()
        })
        console.log('this.auditState', this.auditState)
        // console.log('this.route', this.$route.query.isview)
        // alert(this.$route.query.isview)
    },
    mounted () {
        // 保存所有tabName
        const arr = [
            'baseInfo',
            'detail',
            'tenderList',
            'files',
            'clause',
            'attach',
            'auditHistory',
            'recodes',
            'close',
            'reg',
            'bidEvaluation',
            'biddingPublicity',
            'bidWinningNotice'
        ]
        this.tabsNameArr = arr
        // 获取最后一个内容区域的高度，计算底部空白
        this.getLastConHeight(arr)
        let $idsTop = []
        window.addEventListener('scroll', () => {
            // 如果手动点击时，则不做滚动事件逻辑，只有滚动屏幕时才走滚动事件逻辑
            if (this.clickTabFlag) {
                return
            }
            if (!$idsTop[$idsTop.length - 1]) {
                $idsTop = arr.map(item => {
                    const itemTop = document.getElementById(item)?.offsetTop
                    return itemTop
                })
            }
            const scrollTop = document.documentElement.scrollTop || document.body.scrollTop
            // 倒序查找
            let curLocal = 0
            for (let len = $idsTop.length, i = len - 1; i >= 0; i--) {
                let item = $idsTop[i]
                if (scrollTop + 1 >= item) {
                    curLocal = i
                    break
                }
            }
            // 设置对应tabName
            this.tabsName = arr[curLocal]
            // 加载组件时重新计算高度
            if (!this.ifLoadComponent(this.tabsName)) {
                this.diyWindowResize()
            }
            // 按需加载组件
            this.demandLoading({ name: this.tabsName })
            // this.loadComponent.add(this.tabsName)
            // 下滑过快可能导致计算高度不准确，下滑到最底部再重新计算
            if ($(document).scrollTop() + $(window).height() >= $(document).height() - 1) {
                setTimeout(() => {
                    this.diyWindowResize()
                }, 500)
            }
        })
        this.screenWidth = document.documentElement.clientWidth - this.topHeight
        this.screenHeight = document.documentElement.clientHeight - this.topHeight
        window.addEventListener('resize', () => {
            this.screenWidth = document.documentElement.clientWidth - this.topHeight
            this.screenHeight = document.documentElement.clientHeight - this.topHeight
            $idsTop = arr.map(item => {
                const itemTop = document.getElementById(item)?.offsetTop
                return itemTop
            })
        })
    },
    beforeDestroy () {
        this.$notify.closeAll()
    },
    methods: {
        ...mapMutations(['setAuditParams', 'setSelectedInfo']),
        startEndStake (startEndStake, index) {
            // 起止桩号、包件清单对应的index
            // eslint-disable-next-line no-debugger
            // debugger
            this.detailsData[index].startEndStake = startEndStake
        },
        inputblur (row, val) {
            row[val] = isNaN(parseFloat(row[val])) ? 0 : parseFloat(row[val])
        },
        getAuditHistory () {
            auditRequest.getAuditHistory(this.auditParams).then(res => {
                this.$refs.ComExaHistory.tableData = res
                this.$refs.ComExaHistory.pagination.total = res.length
            })
        },
        // 审核相关操作
        async exas (arg, routeTo) {
            if (arg === 'audit') {
                // 包件验证
                if (!this.$refs.ComDetailsOfProposedIndex.detailRule()) return
                // 清单验证
                if (!this.$refs.ComtenderListIndex.tenderListRule()) return
                this.saveAllData(false)
                this.setAuditParams(this.auditParams)
                // 客户端弹窗弹出本地页面
                openAppClient(
                    '/exaDialog',
                    '填写审核意见',
                    () => {
                        const auditParams = JSON.parse(localStorage.vuex).auditParams
                        if (auditParams.opinion === '') {
                            this.clientPop('err', '审核意见未填')
                            return
                        }
                        auditRequest.audit(auditParams).then(() => {
                            if (auditParams.isPass) {
                                this.clientPop('suc', '审核成功', routeTo)
                            } else {
                                this.clientPop('suc', '返回修改成功', routeTo)
                            }
                            this.getCurrentUnitInfo()
                            this.getData()
                            this.$refs.ComExaHistory.getAuditHistory()
                            this.$refs.ComBidButtons.getButtonState() // 刷新招标按钮
                        })
                    },
                    null,
                    null,
                    null,
                    'small'
                )
            } else if (arg === 'undoAudit') {
                this.clientPop('info', '确定要撤回上一步审核操作吗？', () => {
                    auditRequest.undoAudit(this.auditParams).then(() => {
                        this.clientPop('suc', '撤回成功', routeTo)
                        this.getCurrentUnitInfo()
                        this.getData()
                        this.$refs.ComExaHistory.getAuditHistory()
                    })
                })
            } else if (arg === 'submitCommit') {
                // 包件验证
                if (!this.$refs.ComDetailsOfProposedIndex.detailRule()) return
                // 清单验证
                if (!this.$refs.ComtenderListIndex.tenderListRule()) return
                // 保存所有信息
                const promise1 = await this.saveAllData(false)
                //   审核
                const promise2 = auditRequest.commit(this.auditParams)
                Promise.all([promise1, promise2]).then(() => {
                    this.clientPop('suc', '保存并提交成功', routeTo)
                    this.getCurrentUnitInfo()
                    this.getData()
                    this.$refs.ComExaHistory.getAuditHistory()
                })
                // 重置
                this.loadComponent = new Set()
                await this.getData()
                this.$route.query.seat = this.tabsName
                this.ifSeat()
            } else if (arg === 'submit') {
                await this.saveAllData()
                // 重置
                this.loadComponent = new Set()
                this.$route.query.seat = this.tabsName
                this.ifSeat()
            } else if (arg === 'nullify') {
                this.setAuditParams(this.nullifyParams)
                // 客户端弹窗弹出本地页面
                openAppClient(
                    '/nullifyDialog',
                    '单据作废原因',
                    () => {
                        const auditParams = JSON.parse(localStorage.vuex).auditParams
                        commonRequest.nullify(auditParams).then(() => {
                            this.clientPop('suc', '作废成功', routeTo)
                            this.getCurrentUnitInfo()
                            this.getData()
                            this.$refs.ComExaHistory.getAuditHistory()
                        })
                    },
                    null,
                    null,
                    null,
                    'small'
                )
            } else if (arg === 'deleteData') {
                this.clientPop('info', '确定要删除吗？数据删除后不可恢复，请谨慎操作！', () => {
                    applyRequest.tenderApplyDeleteBatch([this.tenderId]).then(() => {
                        const callBack = () => {
                            this.$router.push('./biddingApplication')
                        }
                        this.clientPop('suc', '删除成功', callBack)
                    })
                })
            }
        },
        async getCurrentUnitInfo () {
            await auditRequest.getCurrentUnitInfo(this.auditParams).then(res => {
                this.auditState = res
            })
        },
        // 基础信息保存
        tenderApplyUpdate () {
            return new Promise((resolve, reject) => {
                // 基础验证
                this.$refs.ruleForm.validate(async valid => {
                    if (valid) {
                        await applyRequest.tenderApplyUpdate(this.formData).then(() => {
                            this.getData()
                            resolve()
                        })
                    } else {
                        this.onChangeTab({ name: 'baseInfo' })
                        reject()
                    }
                })
            })
        },
        // 保存
        saveAllData (notice = true) {
            return new Promise((resolve, reject) => {
                // 公开招标公告必填
                if (this.formData.tenderForm === '1' && this.formData.tenderNotice === '') {
                    this.clientPop('err', '公开招标时必填公告')
                    reject()
                    return
                }
                // 基础信息更新
                const promise1 = this.tenderApplyUpdate()
                // 拟招标内容明细更新
                const promise2 = (() => {
                    if (this.$refs?.ComDetailsOfProposedIndex) {
                        return this.$refs.ComDetailsOfProposedIndex.save()
                    }
                })()
                // 招标清单保存（更新）
                const promise3 = (() => {
                    if (this.$refs.ComtenderListIndex) {
                        return this.$refs.ComtenderListIndex.save()
                    }
                })()
                // 公文文件保存
                // const promise4 = this.$refs.ComFilesIndex.save()
                Promise.all([promise1, promise2, promise3]).then(() => {
                    resolve()
                    if (!notice) return
                    this.clientPop('suc', '保存成功')
                })
            })
        },
        noticeSave (content) {
            this.formData.tenderNotice = content
        },
        handleNotice () {
            this.dialogVisible = true
        },
        nullify () {},
        deleteData (type) {
            type
            const length = this.$refs.ComFilesIndex.selection.length
            this.clientPop(
                'info',
                `已选择【${length}】条数据，确定要删除吗？数据删除后不可恢复，请谨慎操作！`,
                this.delFiles
            )
        },
        downFile () {
            this.$refs.ComFilesIndex.downFile()
        },
        delFiles () {
            this.$refs.ComFilesIndex.delFiles()
        },
        diyWindowResize () {
            if (document.createEvent) {
                var event = document.createEvent('HTMLEvents')
                event.initEvent('resize', true, true)
                window.dispatchEvent(event)
            } else if (document.createEventObject) {
                window.fireEvent('onresize')
            }
        },
        ifLoadComponent (component) {
            if (component === undefined) return
            return this.loadComponent.has(component)
        },
        ifSeat () {
            if (this.$route.query.seat) {
                this.tabsName = this.$route.query.seat
                this.onChangeTab(this.$route.query.seat)
            }
        },
        handleClose () {
            this.$router.push('biddingApplication')
        },
        // 获取最后一个内容区域的高度  ，计算底部空白
        getLastConHeight (arr) {
            let si = setInterval(() => {
                // 因为dom异步加载，通过轮询找到渲染后的dom，获取高度
                if (document.getElementById(arr[length - 1] + 'Con')) {
                    const lastConHeight = document.getElementById(
                        arr[length - 1] + 'Con'
                    )?.offsetHeight
                    this.lastConHeight = lastConHeight
                    clearInterval(si)
                    si = null
                }
            }, 100)
        },
        async demandLoading (e) {
            this.loadComponent.add(e.name)
            if (e.name === 'tenderList') {
                this.tenderListShow += 1
            }
            const nextComponent = this.tabsNameArr.find(
                (value, index) =>
                    index === this.tabsNameArr.findIndex(value => value === e.name) + 1
            )
            const nextComponent2 = this.tabsNameArr.find(
                (value, index) =>
                    index === this.tabsNameArr.findIndex(value => value === e.name) + 2
            )
            this.loadComponent.add(nextComponent)
            this.loadComponent.add(nextComponent2)
        },
        onChangeTab (e) {
            console.log('onChangeTab', e)
            if (!e.name) {
                let temp = e
                e = {}
                e.name = temp
            }
            console.log('e', e)
            $.scrollTo(`#${e.name}`, 500)
            // 如果手动点击时，则不做滚动事件逻辑，只有滚动屏幕时才走滚动事件逻辑
            this.clickTabFlag = true
            // 动画结束后，恢复状态
            setTimeout(() => {
                this.clickTabFlag = false
            }, 600)
            // 加载组件时重新计算高度
            if (!this.ifLoadComponent(this.tabsName)) {
                this.diyWindowResize()
            }
            // 按需加载组件
            this.demandLoading(e)
        },
        clientSelect (name, company) {
            if (name === 'orgSelectData') {
                selectDataClient({
                    SelectServiceToken: '/hr/org/getChildrenOrg', // 客户端对应方法名
                    IsSingleMode: true, // 是否单选 true 单选 false 多选
                    SelectedIDs: [], // 已选中id
                    Title: '选择申请单位' // 标题
                }).then(val => {
                    if (company === 'applyOrgName') {
                        this.formData.applyOrgId = val[0].orgId
                        this.formData.applyOrgName = val[0].orgName
                    } else {
                        this.formData.tenderUserId = val[0].orgId
                        this.formData.tenderUser = val[0].orgName
                    }
                    // // 保存用户选择返回数据到store
                    // this.setSelectedInfo(val)
                    // // 客户端弹窗预览结果
                    // // 参数依次为: 打开页面地址、标题、回调函数
                    // openAppClient('/showSelectedData', '选择结果', function () {})
                })
            } else if (name === 'docSelectData') {
                // selectDataClient({
                //     SelectServiceToken: '/tender/document/listByEntity', // 客户端对应方法名
                //     IsSingleMode: true, // 是否单选 true 单选 false 多选
                //     SelectedIDs: [], // 已选中id
                //     Title: '选择公文', // 标题
                //     OrgId: this.userInfo.orgInfo.orgId
                // }).then(val => {
                //     this.$refs.ComFilesIndex.tableData = val
                //     this.$refs.ComFilesIndex.tableData.forEach((item, index) => {
                //         item.documentNo = val[index].docNum
                //         item.oaCreatTime = val[index].oaCreateTime
                //         item.createUser = val[index].userName
                //         item.filePath = val[index].docStr
                //         item.name = val[index].name
                //         item.changeType = 1
                //         item.billId = this.tenderId
                //     })
                //     // this.setSelectedInfo(val)
                //     // openAppClient('/showSelectedData', '选择结果', function () {})
                // })
            }
        },
        currentTabComponent (name) {
            return this.currentTabComponentName === name
        },
        selectChange (kvId, label) {
            if (label === '招标方式') {
                this.options.tenderForm.forEach(item => {
                    if (kvId === item.value) {
                        this.formData.tenderFormName = item.label
                    }
                })
            } else if (label === '币种') {
                let index
                this.options.currency.forEach((item, key) => {
                    if (item.kvValue === kvId) {
                        index = key
                        this.formData.currency = item.kvKey
                    }
                })
                authRequest
                    .getRmbRate({
                        currency: index,
                        orgId: this.userInfo.orgInfo.orgId
                    })
                    .then(res => {
                        this.formData.rmbRate = res.rate
                        this.formData.rmbAmount = this.formData.tenderAmount * res.rate
                    })
                    .catch(() => {
                        this.formData.rmbRate = 0
                    })
            } else if (label === '招标类型') {
                this.options.tenderType.forEach((value, key) => {
                    if (kvId === key) {
                        this.formData.tenderTypeName = value
                    }
                })
            } else if (label === '项目名称') {
                ;('等待接口')
            }
        },
        noFocus () {
            this.$refs.noFocus1?.blur()
            this.$refs.noFocus2?.blur()
        },
        async getData () {
            await applyRequest.tenderApplyFindById(this.tenderId).then(res => {
                this.formData = res
                // 假数据
                if(this.$route.fullPath.includes('e9704787')) {
                    this.$set(this.formData, 'isTransfer', 1)
                }
                this.cloneFormDataStr = JSON.stringify(res)
                // this.formData.tenderForm = JSON.parse(this.formData.tenderForm) // 招标方式返的字符串
                // res
                // this.formData.tenderState = 0 //假数据
            })
            // 以下是关于招标条款引入在线word文档的代码
            if (!this.formData.tenderClausePath) {
                axios
                    .post('/node/generate', {
                        billId: this.$route.query.billid,
                        token: localStorage.getItem('token'),
                        org: encodeURIComponent(JSON.stringify(store.state.userInfo.orgInfo)),
                        module: 'gcsgzb' // 工程施工招标
                    })
                    .then(res => {
                        const data = JSON.parse(res.data.body)
                        const fileName = encodeURI(data.filename)
                        this.formData.tenderClausePath = `http://192.168.100.100:1027/getFileUrl?fileName=${fileName}`
                    })
            }
        },
        // handleClose () {
        //     this.$router.push('./biddingApplication')
        // },
        cellClsNm ({ column }) {
            if (column.label === '') {
                return 'fixed-left'
            }
        },
        cellMouseEnter (row) {
            this.MouseEnterId = row.id
        },
        cellMouseLeave () {
            this.MouseEnterId = 0
        }
    }
}
</script>

<style lang="scss" scoped>
.form {
    margin-top: 10px;
}

.e-table {
    background: #fff;

    /* .top {
    .left {
      padding: 20px;
      padding-top: 0px;
    }
  } */
}
.normal {
    height: 99%;
    width: 100%;
}
.clauseFixed {
    position: fixed;
    top: 0;
    left: 190px;
    height: calc(100% - 74px);
    width: calc(100% - 210px);
    z-index: 1000;
    margin-bottom: 880px;
}
</style>
